
import 'package:Flutter_Demo/core/model/meal_model.dart';
import 'package:Flutter_Demo/core/viewmodel/favor_view_model.dart';
import 'package:Flutter_Demo/ui/widgets/meal_item.dart';
import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart';

class MYFavorContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Consumer<MYFavorViewModel>(
        builder: (ctx, favorViewModel, child) {
          if (favorViewModel.favorMeals.length <= 0) {
            return Center(
              child: Text("暂无数据"),
            );
          }
          return ListView.builder(
              itemCount: favorViewModel.favorMeals.length,
              itemBuilder: (itemCtx, index) {
                return MYMealItem(favorViewModel.favorMeals[index]);
              }
          );
        }
    );
  }
}

